package com.skcc.cop.mrtaxi4driver;

import java.util.HashSet;
import java.util.Set;

import android.content.Context;
import android.content.SharedPreferences;

public class PreferenceManager {
	private static final String STORE_NAME = "APP_SETTING";

	private Context context;
	private SharedPreferences preferences;
	private Set<String> categories;


	public PreferenceManager(Context c) {
		this.context = c;

		preferences = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE);
		categories = new HashSet<String> ();
	}

	public void putString(String key,String value) {
		preferences.edit().putString(key, value).commit();
	}

	public String getString(String key,String defStr) {
		return (preferences.getString(key, defStr));
	}
	
	public void putBoolean(String key, boolean value) {
		preferences.edit().putBoolean(key, value).commit();
	}

	public boolean getBoolean(String key, boolean defStr) {
		return (preferences.getBoolean(key, defStr));
	}

	public void remove(String key) {
		preferences.edit().remove(key).commit();
	}

	public void clear() {
		preferences.edit().clear().commit();
	}

	public Set<String> getCategories() {
		return categories;
	}

}
